/**
 * Copyright (c) 2017-2018, zengjintao (1913188966@qq.com).
 * <p>
 * Licensed under the GNU Lesser General Public License (LGPL) ,Version 3.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.gnu.org/licenses/lgpl-3.0.txt
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.jfast.framework.kit;


public class StrKit {
	
	/**
	 * 判断字符串是否为空
	 */
	public static boolean isEmpoty(String str){
		return str == null || str.trim().length() == 0 ? true : false;
	}
	
	public static boolean isbank(String str){
		return str == null ? true : false;
	}
	
	public static boolean isEmpty(String[] properties) {
		return properties == null || properties.length == 0 ? true : false;
	}
	
	public static boolean isNotbank(String str){
		return str != null && str.length() > 0 ? true:false;
	}
	
	public static boolean isEmpoty(Object object){
		return object == null || object.toString().trim().length() == 0 ? true : false;
	}
	
	public static boolean isNotEmpoty(String str){
		return str != null && str.trim().length() > 0 ? true:false;
	}
	
	public static boolean isNotEmpoty(Object object){
		return object != null ? true : false;
	}
	
	/**
	 * 将字符串转换成数组
	 */
	public static String[] spilt(String str){
		if(str == null)
			throw new NullPointerException("str can not be null");
		return str.split(",");
	}
	
	public static String[] spilt(String str,String separator){
		if(str == null)
			throw new NullPointerException("str can not be null");
		return str.split(separator);
	}
	
	/**
	 * 将首字母变成小写
	 * @param keyName
	 * @return
	 */
	public static String toLowerCaseFirst(String keyName){
		return keyName.substring(0,1).toLowerCase() + keyName.substring(1,keyName.length());
	}
	
	/**
	 * 将首字母变成大写
	 */
	public static String toUpperCaseFirst(String keyName){
		return keyName.substring(0,1).toUpperCase() + keyName.substring(1,keyName.length());
	}
}
